package com.example.controller;

import com.example.service.MagazineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/magazine")
public class MagazineController {
    @Autowired
    private MagazineService magazineService;
    @PutMapping("/clear/issn")
    public String clearProblemIssn(String path){
        return magazineService.clearProblemIssn(path);
    }
    @DeleteMapping("/delete")
    public String delete(String deletePath){
        Integer num = magazineService.updateDelFlagByMagazines(deletePath);
        return "删除了"+num+"个";
    }

    /**
     * 更新杂志标签名
     * @param originalPath
     * @return 字符串提示信息
     */
    @PutMapping("/update/labelName")
    public String updateMagazineLabelName(String originalPath){
        return magazineService.updateMagazineLabelName(originalPath);
    }
}
